package com.sugar.MultiThread.a14waitandnotify;

import java.util.concurrent.ArrayBlockingQueue;

/**
 * @author felix
 * @date 2025/2/26 09:33
 */
public class ThreadDemo {
    public static void main(String[] args) {
        /*
         *
         *    需求：利用阻塞队列完成生产者和消费者（等待唤醒机制）的代码
         *    细节：
         *           生产者和消费者必须使用同一个阻塞队列
         *
         * */

        ArrayBlockingQueue queue = new ArrayBlockingQueue<>(1);


        Cook cook = new Cook(queue);
        Foodie foodie = new Foodie(queue);

        cook.setName("厨子");
        foodie.setName("吃货");

        cook.start();
        foodie.start();
    }
}
